package sample.controller.model;

import java.util.Date;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@Model
public class Todo {

    private static final long serialVersionUID = 1L;
    
    @Attribute(primaryKey = true)
    private Key key;
    
    @Attribute(persistent = false)
    private Category category;
    
    private String content;
    private Date createdAt;
    private Boolean done;
    
    public String getStatus() {
        if (done == null || !done) {
            return "未";
        }
        return "完了済";
    }
    
    public Key getKey() {
        return key;
    }
    public void setKey(Key key) {
        this.key = key;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Date getCreatedAt() {
        return createdAt;
    }
    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }
    public Boolean getDone() {
        return done;
    }
    public void setDone(Boolean done) {
        this.done = done;
    }
    public String getStringKey() {
        return KeyFactory.keyToString(key);
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Category getCategory() {
        return category;
    }
    
}
